package com.niodata.dp.core.resource;

import com.niodata.dp.core.OwnerType;
import java.util.Date;

/**
 * resource info.
 */
public class ResourceDetail {

  private String id;
  private String path;
  private long ownerId;
  private OwnerType ownerType = OwnerType.GROUP;
  private ResourceType resourceType;
  private Date createTime;

  public String getPath() {
    return path;
  }

  public void setPath(String path) {
    this.path = path;
  }

  public ResourceType getResourceType() {
    return resourceType;
  }

  public void setResourceType(ResourceType resourceType) {
    this.resourceType = resourceType;
  }

  public long getOwnerId() {
    return ownerId;
  }

  public void setOwnerId(long owerId) {
    this.ownerId = owerId;
  }

  public String getId() {
    return id;
  }

  public void setId(String id) {
    this.id = id;
  }

  public Date getCreateTime() {
    return createTime;
  }

  public void setCreateTime(Date createTime) {
    this.createTime = createTime;
  }

  public OwnerType getOwnerType() {
    return ownerType;
  }

  public void setOwnerType(OwnerType ownerType) {
    this.ownerType = ownerType;
  }

  public String getTypeName() {
    return resourceType.getTypeName();
  }

  public void setTypeName(String typeName) {
    ResourceType resType = ResourceType.getResourceTypeByName(typeName);
    if (resType == null) {
      throw new RuntimeException("no resource type named as " + typeName);
    }
    this.resourceType = resType;
  }

}
